
package com.cari.baju.yog;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.cari.baju.yog.utils.Utils;

public class PilihCariActivity extends Activity implements OnClickListener {

    private Bundle data;
    private Button btnCariNama, btnCariJarak;
    private TextView title;
    private int category;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pilih_cari);

        // getSupportActionBar().setTitle("Pencarian");

        data = getIntent().getExtras();

        btnCariJarak = (Button) findViewById(R.id.cari_jarak);
        btnCariNama = (Button) findViewById(R.id.cari_nama);

        title = (TextView) findViewById(R.id.title_judul);

        if (data != null) {
            category = data.getInt("cat");
            switch (category) {
                case MainActivity.CATEGORY_BATIK:
                    title.setText("Cari Baju Batik");
                    break;
                case MainActivity.CATEGORY_CASUAL:
                    title.setText("Cari Baju Casual");
                    break;
                case MainActivity.CATEGORY_MUSLIM:
                    title.setText("Cari Baju Muslim");
                    break;

            }
        }

        // ganti font
        title.setTypeface(Utils.getCustomFont(this));

        btnCariJarak.setOnClickListener(this);
        btnCariNama.setOnClickListener(this);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        // getMenuInflater().inflate(R.menu.pilih_cari, menu);
        return true;
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        if (v == btnCariNama) {
            startActivity(new Intent(this, CariAllActivity.class).putExtras(data));
        } else if (v == btnCariJarak) {
            startActivity(new Intent(this, PilihJarakActivity.class).putExtras(data));
        }

    }

}
